/**
 * Web application lifecycle listener.
 * @author guysagy
 */
package controller;

import javax.servlet.ServletContextAttributeEvent;
import javax.servlet.ServletContextAttributeListener;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.ServletRequestAttributeEvent;
import javax.servlet.ServletRequestAttributeListener;
import javax.servlet.ServletRequestEvent;
import javax.servlet.ServletRequestListener;
import javax.servlet.http.HttpSessionAttributeListener;
import javax.servlet.http.HttpSessionBindingEvent;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;
import webSiteDataStore.ConnectionPool;


public class WebAppListener implements ServletContextListener, ServletContextAttributeListener, HttpSessionListener, HttpSessionAttributeListener, ServletRequestListener, ServletRequestAttributeListener {

    public void contextInitialized(ServletContextEvent sce) 
    {

        ConnectionPool.createInstance();
    }

    public void contextDestroyed(ServletContextEvent sce) 
    {
        /*
        try
        {
            ConnectionMgr.destroyConnection();
        } 
        catch (SQLException ex)
        {
            Logger.getLogger(WebAppListener.class.getName()).log(Level.SEVERE, null, ex);
        }
         */
    }

    public void attributeAdded(ServletContextAttributeEvent event) {
       // throw new UnsupportedOperationException("Not supported yet.");
    }

    public void attributeRemoved(ServletContextAttributeEvent event) {
        //throw new UnsupportedOperationException("Not supported yet.");
    }

    public void attributeReplaced(ServletContextAttributeEvent event) {
       // throw new UnsupportedOperationException("Not supported yet.");
    }

    public void sessionCreated(HttpSessionEvent se) {
       // throw new UnsupportedOperationException("Not supported yet.");
    }

    public void sessionDestroyed(HttpSessionEvent se) {
       // throw new UnsupportedOperationException("Not supported yet.");
    }

    public void attributeAdded(HttpSessionBindingEvent event) {
        //throw new UnsupportedOperationException("Not supported yet.");
    }

    public void attributeRemoved(HttpSessionBindingEvent event) {
        //throw new UnsupportedOperationException("Not supported yet.");
    }

    public void attributeReplaced(HttpSessionBindingEvent event) {
       // throw new UnsupportedOperationException("Not supported yet.");
    }

    public void requestDestroyed(ServletRequestEvent sre) {
       // throw new UnsupportedOperationException("Not supported yet.");
    }

    public void requestInitialized(ServletRequestEvent sre) {
        //throw new UnsupportedOperationException("Not supported yet.");
    }

    public void attributeAdded(ServletRequestAttributeEvent srae) {
        //throw new UnsupportedOperationException("Not supported yet.");
    }

    public void attributeRemoved(ServletRequestAttributeEvent srae) {
        //throw new UnsupportedOperationException("Not supported yet.");
    }

    public void attributeReplaced(ServletRequestAttributeEvent srae) {
        //throw new UnsupportedOperationException("Not supported yet.");
    }
}
